import { http } from '@/utils/http'
import type { PageParams, PageResult } from '@/types/global'
import type { BannerItem, CategoryItem, HotItem, GuessItem } from '@/types/home'

/**
 * 首页轮播图
 * @param site 1: 首页 2: 分类页
 * @returns
 */
export const getBannerAPI = (site = 1) => {
  return http<BannerItem[]>({
    url: '/home/banner',
    method: 'GET',
    data: { distributionSite: site },
  })
}

/**
 * 首页分类
 * @returns
 */
export const getCategoriesAPI = () => {
  return http<CategoryItem[]>({
    url: '/home/category/mutli',
    method: 'GET',
  })
}

/**
 * 首页热门推荐
 * @returns
 */
export const getHotAPI = () => {
  return http<HotItem[]>({
    url: '/home/hot/mutli',
    method: 'GET',
  })
}

/**
 * 猜你喜欢
 */
export const getGuessLikeGoodsAPI = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}
